package Form;

import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import java.awt.GridLayout;
import javax.swing.JScrollPane;
import javax.swing.border.LineBorder;

import Control.Shop_OrderHistory_Controller;

import java.awt.Color;

@SuppressWarnings("serial")
public class Shop_OrderHistory_Form extends JPanel {
	private JTabbedPane histories;
	private JPanel Pending;
	private JPanel Ready;
	private JPanel Collected;
	private JScrollPane readyScrollPane;
	private JScrollPane pendingScrollPane;
	private JScrollPane collectedScrollPane;
	
	private Main parser;
	private Shop_OrderHistory_Controller control;
	
	public Main getParser() {
		return parser;
	}

	public void setParser(Main parser) {
		this.parser = parser;
	}

	public Shop_OrderHistory_Controller getControl() {
		return control;
	}

	public void setControl(Shop_OrderHistory_Controller control) {
		this.control = control;
	}

	public Shop_OrderHistory_Form(Main parser) {
		setParser(parser);
		setControl(new Shop_OrderHistory_Controller(this));
		
		setLayout(new GridLayout(1, 1, 0, 0));
		add(getHistories());
	}

	public JTabbedPane getHistories() {
		if (histories == null) {
			histories = new JTabbedPane(JTabbedPane.TOP);
			histories.addTab("Ready", null, getReady(), null);
			histories.addTab("Pending", null, getPending(), null);
			histories.addTab("Collected", null, getCollected(), null);
		}
		return histories;
	}
	public JPanel getPending() {
		if (Pending == null) {
			Pending = new JPanel();
			Pending.setBorder(new LineBorder(new Color(64, 64, 64), 4));
			Pending.setLayout(new GridLayout(0, 1, 0, 0));
			Pending.add(getPendingScrollPane());
		}
		return Pending;
	}
	public JPanel getReady() {
		if (Ready == null) {
			Ready = new JPanel();
			Ready.setBorder(new LineBorder(new Color(64, 64, 64), 4));
			Ready.setLayout(new GridLayout(0, 1, 0, 0));
			Ready.add(getReadyScrollPane());
		}
		return Ready;
	}
	public JPanel getCollected() {
		if (Collected == null) {
			Collected = new JPanel();
			Collected.setBorder(new LineBorder(new Color(64, 64, 64), 4));
			Collected.setLayout(new GridLayout(0, 1, 0, 0));
			Collected.add(getCollectedScrollPane());
		}
		return Collected;
	}
	public JScrollPane getReadyScrollPane() {
		if (readyScrollPane == null) {
			readyScrollPane = new JScrollPane();
			readyScrollPane.setBorder(null);
		}
		return readyScrollPane;
	}
	public JScrollPane getPendingScrollPane() {
		if (pendingScrollPane == null) {
			pendingScrollPane = new JScrollPane();
			pendingScrollPane.setBorder(null);
		}
		return pendingScrollPane;
	}
	public JScrollPane getCollectedScrollPane() {
		if (collectedScrollPane == null) {
			collectedScrollPane = new JScrollPane();
			collectedScrollPane.setBorder(null);
		}
		return collectedScrollPane;
	}
}
